/**
 */
package DentalClinicEMF.clinic.impl;

import DentalClinicEMF.clinic.Appointment;
import DentalClinicEMF.clinic.ClinicPackage;
import DentalClinicEMF.clinic.Schedule;

import java.util.Collection;
import java.util.Date;
import java.util.HashMap;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

import org.eclipse.emf.ecore.util.EDataTypeUniqueEList;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Schedule</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link DentalClinicEMF.clinic.impl.ScheduleImpl#getAppointments <em>Appointments</em>}</li>
 *   <li>{@link DentalClinicEMF.clinic.impl.ScheduleImpl#getHasAppointments <em>Has Appointments</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ScheduleImpl extends MinimalEObjectImpl.Container implements Schedule {
	/**
	 * The cached value of the '{@link #getAppointments() <em>Appointments</em>}' attribute list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getAppointments()
	 * @generated
	 * @ordered
	 */
	protected EList appointments;

	/**
	 * The cached value of the '{@link #getHasAppointments() <em>Has Appointments</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getHasAppointments()
	 * @generated
	 * @ordered
	 */
	protected EList hasAppointments;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ScheduleImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EClass eStaticClass() {
		return ClinicPackage.Literals.SCHEDULE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList getAppointments() {
		if (appointments == null) {
			appointments = new EDataTypeUniqueEList(HashMap.class, this, ClinicPackage.SCHEDULE__APPOINTMENTS);
		}
		return appointments;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList getHasAppointments() {
		if (hasAppointments == null) {
			hasAppointments = new EObjectContainmentEList(Appointment.class, this, ClinicPackage.SCHEDULE__HAS_APPOINTMENTS);
		}
		return hasAppointments;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean schedule(Appointment apt) {
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean cancel(Appointment apt) {
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean isFree(Date date, int startTime, int endTime) {
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case ClinicPackage.SCHEDULE__HAS_APPOINTMENTS:
				return ((InternalEList)getHasAppointments()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ClinicPackage.SCHEDULE__APPOINTMENTS:
				return getAppointments();
			case ClinicPackage.SCHEDULE__HAS_APPOINTMENTS:
				return getHasAppointments();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ClinicPackage.SCHEDULE__APPOINTMENTS:
				getAppointments().clear();
				getAppointments().addAll((Collection)newValue);
				return;
			case ClinicPackage.SCHEDULE__HAS_APPOINTMENTS:
				getHasAppointments().clear();
				getHasAppointments().addAll((Collection)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eUnset(int featureID) {
		switch (featureID) {
			case ClinicPackage.SCHEDULE__APPOINTMENTS:
				getAppointments().clear();
				return;
			case ClinicPackage.SCHEDULE__HAS_APPOINTMENTS:
				getHasAppointments().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ClinicPackage.SCHEDULE__APPOINTMENTS:
				return appointments != null && !appointments.isEmpty();
			case ClinicPackage.SCHEDULE__HAS_APPOINTMENTS:
				return hasAppointments != null && !hasAppointments.isEmpty();
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (appointments: ");
		result.append(appointments);
		result.append(')');
		return result.toString();
	}

} //ScheduleImpl
